import React, { useEffect } from 'react';
// const { ipcRenderer} = require('electron')
import NavBar from '../components/NavBar/NavBar';
import { Button } from 'antd-mobile';
const RemoveFile = () => {
  const handleButtonClick = () => {
    // ipcRenderer.send('start-fetching-data',)
    // ipcRenderer.on('data-fetching-complete',(event,message)=>{
    //   console.log(message)//输出数据获取完成
    // })

    window.electron.ipcRenderer.sendMessage('start-move-file', []);
  };
  useEffect(() => {
    const unsubscbibe = window.electron.ipcRenderer.on(
      'file-move-complete',
      (e: any, data: any) => {
        console.log(e);
        console.log(data);
      },
    );

    return () => {
      unsubscbibe();
    };
  }, []);

  return (
    <div>
      <NavBar></NavBar>
      <Button block color="primary" size="large" onClick={handleButtonClick}>
        迁移文件
      </Button>
    </div>
  );
};

export default RemoveFile;
